package operation;
import book.BookList;

import book.Book;

import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: wangj
 * Date: 2022-02-28
 * Time: 20:59
 */
public class FindOperation implements IOperation{
    public void work(BookList bookList) {
        System.out.println("查找图书！");
        System.out.println("请输入要查找的图书:");
        Scanner scan=new Scanner(System.in);
        String name=scan.nextLine();
        int count= bookList.getUsedSize();
        for (int i = 0; i < count; i++) {
            Book book=bookList.getBookList(i);
            if(book.getName().equals(name)){
                System.out.println("图书信息:");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有这本书！");
    }
}